/**
 * 
 */
package org.o14x.alpha.ui.views.foldertree;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Data input for the TreeViewers of the FolderTree.
 * 
 * @author Olivier DANGREAUX
 */
public class FolderTreeInput {
	/**
	 * Roots
	 */
	private List<File> roots;

	/**
	 * Creates a new instance of FolderTreeInput.
	 */
	public FolderTreeInput() {
		refresh();
	}

	/**
	 * Returns the value of roots.
	 *
	 * @return The value of roots.
	 */
	public File[] getRootsArray() {
		return roots.toArray(new File[0]);
	}

	/**
	 * Sets the value of roots.
	 *
	 * @param roots The value of roots to set.
	 */
	public void setRoots(List<File> roots) {
		this.roots = roots;
	}

	/**
	 * Returns the value of roots.
	 *
	 * @return The value of roots.
	 */
	public List<File> getRoots() {
		return roots;
	}

	/**
	 * Refreshes roots of this input.
	 */
	public void refresh() {
		roots = new ArrayList<File>();
		roots.addAll(Arrays.asList(File.listRoots()));
	}
}
